<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" layout:decorator="layout">
<head>
    <title>Welcome to Potato workshop</title>
</head>
<body>

<div class="row" layout:fragment="content"><br/>



    <div class="row">
        <div class="col-md-6 col-md-offset-3">
            <form autocomplete="off" action="#" th:action="@{/registration}"
                  th:object="${user}" method="post" class="form-horizontal"
                  role="form">
                <h2>Registration Form</h2>
                <div class="form-group">
                    <div class="col-sm-9">
                        <label th:if="${#fields.hasErrors('name')}" th:errors="*{name}"
                               class="validation-message"></label>
                        <input type="text" th:field="*{name}" placeholder="Name"
                               class="form-control"/>
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-sm-9">
                        <label th:if="${#fields.hasErrors('fullName')}" th:errors="*{fullName}"
                               class="validation-message"></label>
                        <input type="text" th:field="*{fullName}"
                               placeholder="Full Name" class="form-control"/>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-9">
                        <input type="text" th:field="*{email}" placeholder="Email"
                               class="form-control"/> <label
                            th:if="${#fields.hasErrors('email')}" th:errors="*{email}"
                            class="validation-message"></label>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-9">
                        <input type="password" th:field="*{password}"
                               placeholder="Password" class="form-control"/> <label
                            th:if="${#fields.hasErrors('password')}" th:errors="*{password}"
                            class="validation-message"></label>
                    </div>
                </div>

                <div class="form-group">
                    <div class="col-sm-4">
                        <button type="submit" class="btn btn-lg btn-primary btn-block">Register User</button>
                    </div>
                    <div class="col-sm-4">

                     <button class="btn btn-lg btn-warning btn-block" onclick="window.location.href ='/login'">Go To Login Page</button>

                    </div>
                </div>

                <h2><span class="text-success" th:utext="${successMessage}"></span></h2>

            </form>


        </div>
    </div>


</body>
</html>